#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <queue>

using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 2e5 + 10;

int n, k;
bool st[N];
PII h[N];

void solve(){
    priority_queue<PII, vector<PII>, greater<PII>> q;
    cin >> n >> k;
    for(int i = 0; i < n; i ++) st[i] = true;
    for(int i = 0; i < n; i ++){
        int th;
        cin >> th;
        h[i] = {th, i};
    }

    for(int i = 0; i < n; i ++){
        int tp;
        cin >> tp;
        q.push({tp, i});
    }

    sort(h, h + n);

    int attk = k;
    int cur = 0;
    bool ok = false;
    while(true){
   //     cout << "attk : " << attk << '\n';
        for(int i = cur; i < n; i ++){
            if(h[i].first > attk){
                cur = i;
                break;
            }else{
                st[h[i].second] = false;
                cur = i;
            }
        }
  //      cout << "cur: " << cur << '\n';

        if(h[cur].first <= attk){
            ok = true;
            break;
        }
     //   cout << q.top().first << " id: " << q.top().second << '\n' ;
        while(!q.empty() && !st[q.top().second]) q.pop();
        
        int tt = k - q.top().first;
     //  cout << "tt: " << tt << "  p: " << q.top().first << '\n';
        if(tt <= 0) break;
        k = tt;
        attk += tt;
    }

    if(ok) cout << "YES" << '\n';
    else cout << "NO" << '\n';
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }
    return 0;
}